package com.nervenets.shopping.hibernate.dao;

import com.nervenets.general.hibernate.dao.BaseDao;
import com.nervenets.shopping.enumeration.UnionType;
import com.nervenets.shopping.hibernate.domain.common.Fav;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface FavDao extends BaseDao<Fav> {
    @Query("select distinct unionId from Fav where deleted = 0 and createBy = :userId and type = :type")
    List<Long> findAllUnionIdByUserId(@Param("userId") long userId, @Param("type") UnionType type);

    Fav findByCreateByAndTypeAndUnionId(long userId, UnionType unionType, long unionId);
}
